
//
//  HHPCommonViewModel.m
//  HHPLiveVideo
//
//  Created by 韩红坡 on 2017/4/24.
//  Copyright © 2017年 韩红坡. All rights reserved.
//

#import "HHPCommonViewModel.h"

@interface HHPCommonViewModel ()

@property (nonatomic, strong) HHPCommonService *service;

@end

@implementation HHPCommonViewModel

- (void)fetchMyOnlineFriendsDataWithCompletionBlock:(void (^)(BOOL))completionBlock
{
    HHPHTTPRequest *request = [self.service fetchMyOnlineFriendsData];
    
    [request startWithSuccess:^(HHPHTTPRequest *request) {
        self.hotLiveArray = request.data;
        
        completionBlock(YES);
    } error:^(HHPHTTPRequest *request) {
        HHPLog(@"%s, %d, %@", __func__, __LINE__, request.error.localizedDescription);
        completionBlock(NO);
    }];
}

- (void)fetchMyAllFriendsDataWithCompletionBlock:(void (^)(BOOL))completionBlock
{
    HHPHTTPRequest *request = [self.service fetchMyAllFriendsData];
    
    [request startWithSuccess:^(HHPHTTPRequest *request) {
        completionBlock(YES);
    } error:^(HHPHTTPRequest *request) {
        completionBlock(NO);
    }];
}

- (HHPCommonService *)service
{
    if (!_service) {
        _service = [[HHPCommonService alloc] init];
    }
    
    return _service;
}
                               
@end
